import request from '@/utils/request'
import apis from './'

export function getList (parameter) {
  return request({
    url: apis.BusinessList,
    method: 'get',
    params: parameter
  })
}

export function getCount (parameter) {
  return request({
    url: `${apis.BusinessList}?type=get_count`,
    method: 'get',
    params: parameter
  })
}

export function getBusinessName (id) {
  return request({
    url: `${apis.BusinessList}?type=get_status2_state_items&category_id=${id}`,
    method: 'get'
  })
}

export function getStatus (id) {
  return request({
    url: `${apis.BusinessList}?type=get_status2_state_items&business_id=${id}`,
    method: 'get'
  })
}

export function getDetail (id) {
  return request({
    url: `${apis.BusinessDetail}?cb_id=${id}`,
    method: 'get'
  })
}

export function getBusinessTransfer (parameter) {
  return request({
    url: apis.BusinessTransfer,
    method: 'get',
    params: parameter
  })
}

export function getInFill (id) {
  return request({
    url: `${apis.GetFillMats}?cb_id=${id}`,
    method: 'get'
  })
}

export function getFill (id) {
  return request({
    url: `${apis.FillEdit}?cb_id=${id}`,
    method: 'get'
  })
}

export function postInFill (data) {
  return request({
    url: `${apis.GetFillMats}?cb_id=${data.cb_id}`,
    method: 'post',
    data: data
  })
}

export function postFill (data) {
  return request({
    url: `${apis.FillEdit}?cb_id=${data.cb_id}`,
    method: 'post',
    data: data
  })
}

export function autoMats (no) {
  return request({
    url: `${apis.AutoMats}?business_no=${no}`,
    method: 'get'
  })
}

export function getBusinessMat (id) {
  return request({
    url: `${apis.BusinessMat}?business_id=${id}`,
    method: 'get'
  })
}

export function getContractInfo (no) {
  return request({
    url: `${apis.ContractDetail}?contract_no=${no}`,
    method: 'get'
  })
}

export function postQuestion (id, data) {
  return request({
    url: `${apis.Question}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function postEditName (id, data) {
  return request({
    url: `${apis.EditName}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function batchDownload (parameter) {
  return request({
    url: apis.BatchDownload,
    method: 'get',
    params: parameter
  })
}

export function getBatchFill (parameter) {
  return request({
    url: apis.BatchFill,
    method: 'get',
    params: parameter
  })
}

export function postBatchFill (parameter, data) {
  return request({
    url: apis.BatchFill,
    method: 'post',
    params: parameter,
    data: data
  })
}

export function getState (parameter) {
  return request({
    url: apis.StateList,
    method: 'get',
    params: parameter
  })
}

export function downloadState (parameter) {
  return request({
    url: apis.BatchDownloadState,
    method: 'get',
    params: parameter
  })
}

export function getEditSubject (id) {
  return request({
    url: `${apis.EditSubject}?cb_id=${id}`,
    method: 'get'
  })
}

export function postEditSubject (id, data) {
  return request({
    url: `${apis.EditSubject}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function hideBusiness (id) {
  return request({
    url: `${apis.HideBusiness}?cb_id=${id}`,
    method: 'get'
  })
}

export function getHideList (parameter) {
  return request({
    url: apis.HideBusinessList,
    method: 'get',
    params: parameter
  })
}

export function getBusinessExplain (parameter) {
  return request({
    url: apis.BusinessExplain,
    method: 'get',
    params: parameter
  })
}

export function getExplainState (id) {
  return request({
    url: `${apis.BusinessExplain}?category_id=${id}`,
    method: 'get'
  })
}
